<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})">
  <title>视频管理</title>
</head>
<body>

  <!--导航-->
  <nav th:replace="admin/_fragments :: menu(4)"></nav>

  <!--中间内容-->
  <div  class="m-container-small m-padded-tb-big">
    <div class="ui container">

      <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
        <i class="close icon"></i>
        <div class="header">提示：</div>
        <p th:text="${message}">恭喜，操作成功！</p>
      </div>

      <div id="table-container">
        <table th:fragment="blogList" class="ui compact teal table">
          <thead>
            <th></th>
            <th>标题</th>
            <th>操作</th>
          </t>
          </thead>
          <tbody>
          <tr th:each="video,iterStat : ${videos}">
            <td th:text="${iterStat.count}">1</td>
            <td th:text="${video.name}"></td>
            <td>
              <a href="#" th:href="@{/admin/videos/{id}/input(id=${video.id})}" class="ui mini teal basic button">编辑</a>
              <a href="#" th:href="@{/admin/videos/{id}/delete(id=${video.id})}" class="ui mini red basic button">删除</a>
            </td>
          </tr>
          </tbody>
          <tfoot>
          <tr>
            <th colspan="7">
              <a href="#" th:href="@{/admin/videos/input}" class="ui mini right floated teal basic button">新增</a>
            </th>
          </tr>
          </tfoot>
        </table>
      </div>

    </div>
  </div>

  <br>
  <br>
  <!--底部footer-->
  <footer th:replace="admin/_fragments :: footer"></footer>

  <!--/*/<th:block th:replace="admin/_fragments :: script">/*/-->
  <!--/*/</th:block>/*/-->
  <script>
    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
      on : 'hover'
    });

    //消息提示关闭初始化
    $('.message .close')
      .on('click', function () {
        $(this)
          .closest('.message')
          .transition('fade');
      });

    $('#clear-btn')
      .on('click', function() {
        $('.ui.type.dropdown')
          .dropdown('clear')
        ;
      })
    ;

    function page(obj) {
      $("[name='page']").val($(obj).data("page"));
      loaddata();
    }

    $("#search-btn").click(function () {
      $("[name='page']").val(1);
      loaddata();
    });
    function loaddata() {
      $("#table-container").load(/*[[@{/admin/blogs/search}]]*/"/admin/blogs/search",{
        title : $("[name='title']").val(),
        typeid : $("[name='typeid']").val(),
        recommend : $("[name='recommend']").prop('checked'),
        published : $("[name='published']").prop('checked'),
        page : $("[name='page']").val()
      });
    }

  </script>
</body>
</html>